import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
data = pd.read_csv("./LSTM预测/ret.csv")
y_true = data["y_true"].values
y_pred = data["y_pred"].values 

plt.figure()
plt.ion()
xs = [0, 1]
ys1 = [1, y_true[0]]
ys2 = [1, y_pred[0]]
for i in range(1,len(y_true),5):
    y1 = y_true[i]
    y2 = y_pred[i]
    xs[0] = xs[1]
    ys1[0] = ys1[1]
    ys2[0] = ys2[1]
    xs[1] = i
    ys1[1] = y1
    ys2[1] = y2
    plt.plot(xs,ys1,"b")
    plt.plot(xs,ys2,"r--")
    plt.pause(0.1)